define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'crm/product.course/index',
        add_url: 'crm/product.course/add',
        edit_url: 'crm/product.course/edit',
        delete_url: 'crm/product.course/delete',
        modify_url: 'crm/product.course/modify',
        recycle_url: 'crm/product.course/recycle'
    };

    var Controller = {

        index: function () {

            ea.table.render({
                init: init,
                cols: [[
                     { type: "checkbox", width: 50, id: 'checked' },
                    { field: 'id', width: 60, title: 'ID', sort: true,search:false },
                    { field: 'name', title: '课程名称' },
                    { field: 'price', title: '价格', width: 130, sort: true,search:false},
                    { field: 'unit_name', width: 60, title: '单位',search:false },
                    { field: 'minute_hour', width: 90, title: '课时/分钟',search:false }, // 一对多数据
                    { field: 'major_id', templet:function(d){return d.major.name}, title: '专业',search: 'select', selectList:_majorList},
                    { field: 'campus_id', templet:function(d){return d.campus.name}, title: '校区',search: 'select', selectList:_campusList},
                    { field: 'create_time', width: 160, title: '创建时间',search:false },
                    { field: 'update_time', width: 160, title: '更新时间',search:false },
                    { title: '操作', minWidth: 80,  width: 90, toolbar: '#currentTableBar', align: "center", fixed: 'right' }
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        password: function () {
            ea.listen();
        }
    };
    return Controller;
});